/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.infonova.education.microservice.repository.entity;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamOmitField;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Stefan
 */
@Entity
@Table
@XStreamAlias("position")
public class OrderPosition {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private long orderPositionId;

    @ManyToOne()
    @XStreamOmitField
    private Order order;

    @XStreamAlias("order")
    private Long orderId;

    @ManyToOne
    @JoinColumn(name = "product_id_fk")
    @XStreamOmitField
    private Product product;

    @XStreamAlias("product")
    private Long productId;

    @Column(name = "anzahl")
    private int anzahl;

    public OrderPosition() {
    }

    public int getAnzahl() {
        return anzahl;
    }

    public Order getOrder() {
        return order;
    }

    public long getOrderPositionId() {
        return orderPositionId;
    }

    public Long getProductId() {
        return productId;
    }

    public void setAnzahl(int anzahl) {
        this.anzahl = anzahl;
    }

    public void setOrder(Order order) {
        this.order = order;
    }

    public void setOrderPositionId(long orderPositionId) {
        this.orderPositionId = orderPositionId;
    }

    public void setProductId(Long productId) {
        this.productId = productId;
    }

    public Long getOrderId() {
        return orderId;
    }

    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }
}
